import { createRouter, createWebHistory } from 'vue-router'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  linkActiveClass: "link-active",
  linkExactActiveClass: "link-active-son",
  sensitive: true,
  strict: true,
  routes: [
    {
      path: '/',
      name: 'index',
      component: () => import('../views/index.vue'),
      meta: {
        keepAlive: true
      }
    },
    {
      path: '/discover',
      name: 'discover',
      component: () => import('../views/HomeView.vue'),
      meta: {
        keepAlive: true
      }
    },
    {
      path: '/discover/:id',
      name: 'discoverId',
      component: () => import('../views/index.vue'),
    },
    {
      path: '/user',
      name: 'user',
      component: () => import('../views/UserView.vue'),
      children: [
        {
          path: '',
          name: 'opus',
          component: () => import('../views/user/OpusView.vue'),
          meta: {
            keepAlive: true
          }
        },
        {
          path: 'favorite',
          name: 'favorite',
          component: () => import('../views/user/FavoriteView.vue'),
          meta: {
            keepAlive: true
          }
        },
        {
          path: 'collection',
          name: 'collection',
          component: () => import('../views/user/CollectionView.vue'),
          meta: {
            keepAlive: true
          }
        },
      ]
    },
    {
      path: '/user/:id',
      name: 'author',
      component: () => import('../views/user/AuthorView.vue'),
    },
    {
      path: '/upload',
      name: 'upload',
      component: () => import('../views/UploadView.vue'),
      meta: {
        keepAlive: true
      }
    },
    {
      path: '/channel/:channelId',
      name: 'channel',
      component: () => import('../views/ChannelView.vue'),
    },
    {
      path: '/search/:keyword',
      name: 'search',
      component: () => import('../views/SearchView.vue'),
    },
  ]
})

export default router
